﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <link href="~/css/shop.css" type="text/css" rel="stylesheet" />
    <link href="~/css/Sellerber.css" type="text/css" rel="stylesheet" />
    <link href="~/css/bkg_ui.css" type="text/css" rel="stylesheet" />
    <link href="~/font/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link href="~/layui/css/layui.css" rel="stylesheet" />
    <script src="~/js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="~/js/Validform/Validform.min.js"></script>
    <script type="text/javascript" src="~/js/jquery.cookie.js"></script>
    <script src="~/js/shopFrame.js" type="text/javascript"></script>
    <script src="~/js/Sellerber.js" type="text/javascript"></script>
    <script src="~/js/jquery.nicescroll.js"></script>
    <script src="~/layui/layui.js"></script>
    <script src="~/js/laydate/laydate.js" type="text/javascript"></script>
    <title>日志列表</title>
</head>
<!--[if lt IE 9]>
  <script src="js/html5shiv.js"></script>
  <script src="js/respond.min.js"></script>
  <script src="js/css3-mediaqueries.js"  type="text/javascript"></script>
  <![endif]-->
<body>
    <div class="margin Competence_style" id="page_style">
        <div class="same_module">
            <div class="Promp_plate btn-info"><b>提示：</b>该记录只保留进一个月的操作记录，请及时处理。<a href="javascript:void()" class="fa fa-close close_Promp"></a></div>

            <div class="operation clearfix mb15 ">
                <ul>
                    <li class="clearfix col-xs-2 col-lg-3 col-ms-3">
                        <label class="label_name col-xs-3 col-lg-3 ">条件搜索：</label>
                        <select id="SelectOption" class="select Competence_sort col-xs-6 col-lg-6 " name="admin-role" size="1" id="Competence_sort">
                            <option value="0">--全部记录--</option>
                            <option value="1">超级管理员</option>
                            <option value="2">普通管理员</option>
                            <option value="3">栏目编辑</option>
                        </select>
                    </li>
                    <li class="clearfix col-xs-5 col-lg-5 col-ms-5 ">
                        <label class="label_name ">添加时间：</label>
                        <input  class="laydate-icon col-xs-4 col-lg-3 form-control Select_Date" id="start" type="text" />
                        <span style=" float:left; padding:0px 10px; line-height:32px;"></span>
                        
                        <button id="SearchTable" class="btn button_btn bg-deep-blue " onclick="" type="button"><i class="fa  fa-search"></i>&nbsp;搜索</button>
                    </li>
                </ul>
            </div>
        </div>

        <div class="Logs" id="Logs">
            <div class="compete_list">
                <table id="Logs_Table" class="layui-hide" lay-filter="test"></table>
            </div>
        </div>
    </div>
</body>
</html>
<script>
    $(function () {
        $("#Logs").frame({
            float: 'left',
            Promp: '.close_Promp',//删除提示
            Sellerber_menu: '.list_content',
            datalist: ".datatable_height",//数据列表高度取值
            header: 65,//顶部高度
            mwidth: 350,//宽度自定义
            minStatue: true,

        });
    });
    $(function () {
        $("#Competence_sort").click(function () {
            var option = $(this).find("option:selected").text();
            var value = $(this).val();
            if (value == 0) {

                $("#sample_table tbody tr").show()
            }
            else {
                $("#sample_table tbody tr").hide().filter(":contains('" + (option) + "')").show();
            }
        }).click();
    });

    /******时间设置*******/
    var start = {
        elem: '#start',
        format: 'YYYY-MM-DD',
        // min: laydate.now(), //设定最小日期为当前日期
        max: '2099-06-16', //最大日期
        istime: true,
        istoday: false,
        choose: function (datas) {
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
        }
    };
    var end = {
        elem: '#end',
        format: 'YYYY-MM-DD',
        //min: laydate.now(),
        max: '2099-06-16',
        istime: true,
        istoday: false,
        choose: function (datas) {
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start);
    laydate(end);
    /*管理员-停用*/
    function Competence_close(obj, id) {
        layer.confirm('确认要停用吗？', function (index) {
            $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" class="btn button_btn btn-gray" onClick="Competence_start(this,id)" href="javascript:;" title="启用">启用</a>');
            $(obj).parents("tr").find(".td-status").html('<span class="label label-success label-sm">已停用</span>');
            $(obj).remove();
            layer.msg('已停用!', { icon: 5, time: 1000 });
        });
    }

    /*管理员-启用*/
    function Competence_start(obj, id) {
        layer.confirm('确认要启用吗？', function (index) {
            $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" class="btn button_btn  btn-Dark-success" onClick="Competence_close(this,id)" href="javascript:;" title="停用">停用</a>');
            $(obj).parents("tr").find(".td-status").html('<span class="label label-success label-sm">已启用</span>');
            $(obj).remove();
            layer.msg('已启用!', { icon: 6, time: 1000 });
        });
    }
    /****复选框选中******/
    $('table th input:checkbox').on('click', function () {
        var that = this;
        $(this).closest('table').find('tr > td:first-child input:checkbox')
            .each(function () {
                this.checked = that.checked;
                $(this).closest('tr').toggleClass('selected');
            });

    });
    //表单验证提交
    $("#form-admin-add").Validform({
        tiptype: 2,
        callback: function (data) {
            //form[0].submit();
            if (data.status == 1) {
                layer.msg(data.info, { icon: data.status, time: 1000 }, function () {
                    location.reload();//刷新页面
                });
            }
            else {
                layer.msg(data.info, { icon: data.status, time: 3000 });
            }
            var index = parent.$("#iframe").attr("src");
            parent.layer.close(index);
            //
        }
    });
    //字数限制
    function checkLength(which) {
        var maxChars = 100; //
        if (which.value.length > maxChars) {
            layer.open({
                icon: 2,
                title: '提示框',
                content: '您输入的字数超过限制!',
            });
            // 超过限制的字数了就将 文本框中的内容按规定的字数 截取
            which.value = which.value.substring(0, maxChars);
            return false;
        } else {
            var curr = maxChars - which.value.length; //250 减去 当前输入的
            document.getElementById("sy").innerHTML = curr.toString();
            return true;
        }
    };
</script>
<script>
    function Format(datetime, fmt) {
    var newtime = datetime.replace(/\/Date\((\d+)\)\//gi, "$1");
    if (parseInt(newtime) == newtime) {
        if (newtime.length == 10) {
            newtime = parseInt(newtime) * 1000;
        } else if (newtime.length == 13) {
            newtime = parseInt(newtime);
        }
    }
    newtime = new Date(newtime);
    var o = {
        "M+": newtime.getMonth() + 1,                 //月份
        "d+": newtime.getDate(),                    //日
        "h+": newtime.getHours(),                   //小时
        "m+": newtime.getMinutes(),                 //分
        "s+": newtime.getSeconds(),                 //秒
        "q+": Math.floor((newtime.getMonth() + 3) / 3), //季度
        "S": newtime.getMilliseconds()             //毫秒
    };
    if (/(y+)/.test(fmt))
        fmt = fmt.replace(RegExp.$1, (newtime.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt))
            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}


    layui.use('table', function () {
        var table = layui.table,
            form = layui.form;
        //第一个实例
        table.render({
            elem: "#Logs_Table",
            height: 400,
            url: '/Logs/LogsTableShow',
            page: true,
            cols: [[ //表头

             { field: 'AdminName', align: 'center', title: '用户名', sort: true }
            , { field: 'Level', align: 'center', title: '等级', sort: true }
            , { field: 'Status', align: 'center', title: '状态', sort: true ,templet: function (d) {
                        if (d.Status) {
                            return "已授权";
                        } else {
                            return "未授权";
                        }
                }
            }
            , { field: 'Operation', align: 'center', title: '正在操作', sort: true }
            , { field: 'BeginTime', align: 'center', title: '操作时间', sort: true, templet: "<div>{{Format(d.BeginTime,'yyyy-MM-dd hh:mm:ss')}}</div>" }
            , { field: 'EndTime', align: 'center', title: '结束时间', sort: true, templet: "<div>{{Format(d.EndTime,'yyyy-MM-dd hh:mm:ss')}}</div>" }
             ]]
        })


        $("#SearchTable").click(function () {
            table.reload('Logs_Table', {
                where: {
                    RoidId: $("#SelectOption").val(),
                    BeginTime: $("#start").val()
                }
            });
        })
    });


</script>

